<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>航线附加费</title>
		<meta name="description" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		
		<!-- 文本框 -->
<link rel="stylesheet" href="static/ace/css/riverboat.css" />
		<script type="text/javascript" src="static/js/jquery-1.7.2.js" />
		<!--提示框-->
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
	<!-- jsp文件头和头部 -->
<%@ include file="../../../system/index/top.jsp"%>
</head>
<body class="no-skin">
<div class="main-container" id="main-container"style="overflow-x:scroll">
	<div class="main-content">
		<div class="main-content-inner">
			<div class="page-content">
				<div class="row">
					<div class="col-xs-12">
						<form action="routeAttchFee/list" method="post" name="routeAttchFeeInfoFrom" id="routeAttchFeeInfoFrom">
						<fieldset>
 								<table style="margin-top:5px;"class="tab2">
 									<tr ><td colspan="2" class="tit2">航线附加费</td></tr>
 									<tr>
 										<td><span class="span10">船公司</span></td>
										<td><input type="text" name="BOAT_COMPANY" id="BOAT_COMPANY"  maxlength="32" /></td>
										<td><span class="span10">航线名称：</span></td>
										<td><input type="text" name="ROUTE_NAME" id="ROUTE_NAME"  maxlength="32" /></td>
 									</tr>
 									<tr>
 										<td><span class="span10">费用名称：</span></td>
										<td><input type="text" name="FEE_NAME" id="FEE_NAME"  maxlength="32"/></td>
										<td><span class="span10">费用价格：</span></td>
										<td><input type="text" name="FEE_PRICE" id="FEE_PRICE" maxlength="32"/></td>
 									</tr>
 									<tr>
 										<td><span class="span10">计费标准：</span></td> 
										<td>
											<select name="CHARG_STANDARD">
											<option value=""></option>
											  <option>票</option>
											  <option>箱</option>
											</select>
										</td>
										<td><span class="span10">箱型：</span></td>
										<td><input type="text" name="BOX_TYPE" id="BOX_TYPE"  maxlength="32" /></td>
 									</tr>
 									<tr>
 										<td><span class="span10">币种类型：</span></td>
										<td><input type="text" name="CURRENCY_TYPE" id="CURRENCY_TYPE" maxlength="32" /></td>
										<td><span class="span10">结算单位：</span></td>
										<td><input type="text" name="SENTTLE_UNIT" id="SENTTLE_UNIT"  maxlength="32" /></td>
 									</tr>
 									<tr>
										<td><span class="span10">是否可用：</span></td>
										<td>
											<select name="ENABLE">
											<option value=""></option>
											  <option value="1">是</option>
											  <option value="0">否</option>
											</select>
										</td>
										<td><span class="span10">检索码：</span></td>
										<td><input type="text" name="SEARCH_CODE" id="SEARCH_CODE"  maxlength="32" /></td>
 									</tr>
 									<tr>
										<td><span class="span10">备注：</span></td>
										<td><textarea id="REMARK" name="REMARK"></textarea></td>
										<td>
										<a class="btn btn-xs btn-success">
											<i class="ace-icon fa fa-pencil-square-o bigger-120" onclick="add();">添加</i>
										</a>
									</td>
									</tr>
 								</table>
 							</fieldset>
						</form>
						<form action="routeAttchFee/list" method="post" name="routeAttchFeeFrom" id="routeAttchFeeFrom">
							<fieldset>
								<table style="margin-top:5px;"class="table table-striped table-bordered table-hover">
									<tr>
										<td style="width:79px;text-align: right;padding-top: 13px;">船公司：</td>
										<td><input type="text"  id="routeName" name="BOAT_COMPANY" maxlength="32" style="width:98%;"/></td>
										<td style="width:79px;text-align: right;padding-top: 13px;">航线名称：</td>
										<td><input type="text"  id="routeName" name="ROUTE_NAME" maxlength="32" style="width:98%;"/></td>
										<td style="width:79px;text-align: right;padding-top: 13px;">费用名称：</td>
										<td><input type="text"  id="routeName" name="FEE_NAME" maxlength="32" style="width:98%;"/></td>
										<td style="text-align: left;" colspan="10">
										<a class="btn btn-xs btn-success">
											<i class="ace-icon fa fa-pencil-square-o bigger-120" onclick="serch();">查询</i>
										</a>
									</td>
									</tr>
<!-- 									<tr> -->
<!-- 									<td style="text-align: left;" colspan="10"> -->
										
<!-- 									</td> -->
<!-- 									</tr> -->
								</table>
							</fieldset>
						</form>
						<fieldset>
						<a class="btn btn-mini btn-danger">
											<i class='ace-icon fa fa-trash-o bigger-120' onclick="deleteInfoAll();">批量删除</i>
											
										</a>
							<table id="simple-table" class="table table-striped table-bordered table-hover"  style="margin-top:5px;">
								<thead>
								<tr id="test1">
									<th class="center" style="width:35px;">
									<label class="pos-rel"><input type="checkbox" class="ace" id="zcheckbox" /><span class="lbl"></span></label>
									</th>
									
									<th class="center"id="option0">船公司</th>
									<th class="center"id="option2"">航线名称</th>
									<th class="center"id="option3">费用名称</th>
				 					<th class="center"id="option4">费用价格</th>
									<th class="center"id="option5">币种类型</th>
									<th class="center"id="option5">计费标准</th>
									<th class="center"id="option5">箱型</th>
									<th class="center"id="option5">备注</th>
									<th class="center"id="option5">是否可用</th>
									<th class="center"id="option5">检索码</th>
									<th class="center"id="option5">结算单位</th>
									<th class="center"id="option5">修改</th>
									<th class="center"id="option5">删除</th>
									
								</tr>
							</thead>
							<tbody>
							<c:choose>
								<c:when test="${not empty routeAttachFee}">
									<c:forEach items="${routeAttachFee}" var="routeAttachFee" varStatus="vs">		
										<tr id="trId">
											<td class="dbclicktd" style="width: 30px;">
												<label><input type='checkbox' value="${routeAttachFee.ID }" id="ids"name="ids"class="ace"/><span class="lbl"></span></label>
												
											</td>
											<td class="dbclicktd"  id="td1">${routeAttachFee.BOAT_COMPANY}</td>
											<td class='dbclicktd' id="td2">${routeAttachFee.ROUTE_NAME}</td>
											<td class="dbclicktd" id="td3">${routeAttachFee.FEE_NAME}</td>
											<td class="dbclicktd"id="td4">${routeAttachFee.FEE_PRICE}</td>
											<td class="dbclicktd"id="td4">${routeAttachFee.CURRENCY_TYPE}</td>
<!-- 											<td> -->
<%-- 											<c:if test="${routeAttachFee.CHARG_STANDARD =='票'}"> --%>
<!-- 											<td class="dbclicktd"id="td5">票</td> -->
<%-- 											</c:if> --%>
<%-- 											<c:if test="${routeAttachFee.CHARG_STANDARD =='箱'}"> --%>
<!-- 											<td class="dbclicktd" id="td5">箱</td> -->
<%-- 											</c:if> --%>
<!-- 											</td> -->
											<td class="dbclicktd"><c:choose><c:when test="${routeAttachFee.CHARG_STANDARD =='票'}">票</c:when>
												<c:otherwise>箱</c:otherwise></c:choose></td>
											<td class="dbclicktd"id="td4">${routeAttachFee.BOX_TYPE}</td>
											<td class="dbclicktd"id="td4">${routeAttachFee.REMARK}</td>
<!-- 											<td> -->
<%-- 											<c:if test="${routeAttachFee.ENABLE ==1}"> --%>
<!-- 											<td class="dbclicktd"id="td5">是</td> -->
<%-- 											</c:if> --%>
<%-- 											<c:if test="${routeAttachFee.ENABLE ==0}"> --%>
<!-- 											<td class="dbclicktd" id="td5">否</td> -->
<%-- 											</c:if> --%>
<!-- 											</td> -->
											<td class="center"><c:choose><c:when test="${routeAttachFee.ENABLE==1}">是</c:when>
												<c:otherwise>否</c:otherwise></c:choose></td>
											<td class="dbclicktd"id="td4">${routeAttachFee.SEARCH_CODE}</td>
											<td class="dbclicktd"id="td4">${routeAttachFee.SENTTLE_UNIT}</td>
											<td class="center">
											<div class="hidden-sm hidden-xs btn-group">
												<a class="btn btn-xs btn-success" onclick="edit('${routeAttachFee.ID}');">
													<i class="ace-icon fa fa-pencil-square-o bigger-120">修改</i>
												</a>
											</div>
											</td>
											<td class="center">
											<div class="hidden-sm hidden-xs btn-group">
												<a class="btn btn-mini btn-danger"onclick="deleteInfo('${routeAttachFee.ID}');">
													<i class="ace-icon fa fa-trash-o bigger-120">删除</i>
												</a>
											</div>
											</td>		
										</tr>
										
									
									</c:forEach>
<!-- 									<div class="hidden-sm hidden-xs btn-group"> -->
<%-- 											<a class="btn btn-xs btn-success" title="编辑" onclick="editUser('${user.USER_ID}');"> --%>
<!-- 														<i class="ace-icon fa fa-pencil-square-o bigger-120" title="编辑"></i> -->
<!-- 													</a> -->
<!-- 												</div> -->
								</c:when>
							</c:choose>
							</tbody>
							</table>
							<div class="page-header position-relative">
							<table style="width:100%;">
							<tr>
								<td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
							</tr>
						</table>
						</div>
						</fieldset>
					</div>
				</div>
			</div>
		</div>
	</div>
	<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
			<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
		</a>
</div>
<%@ include file="../../../system/index/foot.jsp"%>
	<!-- ace scripts -->
	<script src="static/ace/js/ace/ace.js"></script>
</body>
<script type="text/javascript">
function add(){
// 	if($("#ROUTE_NAME").val()==""){
// 		$("#ROUTE_NAME").tips({
// 			side:3,
//             msg:'请填写航线名称',
//             bg:'#AE81FF',
//             time:2
//         });
// 		$("#ROUTE_NAME").focus();
// 		$("#ROUTE_NAME").val('');
// 		$("#ROUTE_NAME").css("background-color","white");
// 		return false;
// 	}
// 	if($("#ENABLE").val()==""){
// 		$("#ENABLE").tips({
// 			side:3,
//             msg:'请填写是否可用',
//             bg:'#AE81FF',
//             time:2
//         });
// 		$("#ENABLE").focus();
// 		$("#ENABLE").val('');
// 		$("#ENABLE").css("background-color","white");
// 		return false;
// 	}

	 $.ajax({
         type: "POST",
         url: '<%=basePath%>routeAttchFee/saveOrupdateInfo',
         data: $("#routeAttchFeeInfoFrom").serialize(),
         dataType: 'json',
         cache: false,
         success: function (data) {
        	 alert("保存成功")
        	 window.location.reload();
        	 
         }
     });
}
function edit(ID){
	 top.jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="编辑";
	 diag.URL = '<%=basePath%>routeAttchFee/editRouteAttachFee?ID='+ID;
	 diag.Width = 469;
	 diag.Height = 510;
	 diag.CancelEvent = function(){ //关闭事件
		window.location.reload();
		diag.close();
	 };
	 diag.show();
}
function deleteInfo(ID){
	$.ajax({
        type: "POST",
        url: '<%=basePath%>routeAttchFee/deleteRouteAttachFee?ID='+ID,
        dataType: 'json',
        cache: false,
        success: function (data) {
       	 window.location.reload();
       	 
        }
    });
}
function serch(){
	top.jzts();
	$("#routeAttchFeeFrom").submit();
	}
function deleteInfoAll(){
	var trList = [];
	var $simpleTabletr = $("#simple-table tbody tr");
	var list = {}
	for(var i=0,len=$simpleTabletr.length;i<len;i++){
		
		var objTr = $simpleTabletr[i];
		
		var flag = $(objTr).find("td").first().find("label").find("#ids")[0].checked;
		if(flag){
			trList.push(objTr);
		}
	}
	//传到后台的data json格式
	var data = [];
	 for(var i=0,size=trList.length;i<size;i++){
		var $tds = $(trList[i]).find("td");
		//id
		var id = $($tds[0]).find("label").find("input[name='ids']")[0].value;
		var item = {};
		item.ID = id.trim();
		data.push(item)
	}
	 var dataStr = JSON.stringify(data);
	 $.ajax({
         type: "POST",
         url: '<%=basePath%>routeAttchFee/deleteRouteAttachFeeAll',
         data: {dataJsonStr:dataStr},
         dataType: 'json',
         //beforeSend: validateData,
         cache: false,
         success: function (data) {
        	 window.location.reload();
        	 
         }
     });
}
$(function() {
	//复选框全选控制
	var active_class = 'active';
	$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
		var th_checked = this.checked;//checkbox inside "TH" table header
		$(this).closest('table').find('tbody > tr').each(function(){
			var row = this;
			if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
			else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
		});
	});
});
</script>
</html>